<?php
namespace app\index\controller;

use app\index\model\Busines;
use app\index\model\Linshi;

class Business extends Publiccom
{
//    商务人员展示
    public function index()
    {
        $back = new Busines();
        $count = count($back -> select());
        $tick = $back -> order('create_time desc') -> paginate(20,$count);
        $this -> assign('list',$tick);
        return view();
    }
    //添加新的商务人员
    public function add()
    {
        $add['shangwu_name'] = input('get.name');
        if (db('busines')->where('shangwu_name',$add['shangwu_name'])->find()){
            return 2;
        }
        $add['uuid'] = create_uuid();
        $add['create_time'] = time();
        $add = db('busines') ->insert($add);
        if ($add){
            return 0;
        }else{
            return 1;
        }
    }
}